package com.ly.juc;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;

/**
 * @Classname TestForkJoinPool
 * @Description TODO
 * @Date 2020/11/18 10:31
 * @Author 冷心影翼
 */
public class TestForkJoinPool {

	public static void main(String[] args) throws ExecutionException, InterruptedException {
		ForkJoinPool forkJoinPool = new ForkJoinPool();
		ForkJoinTask<Long> submit = forkJoinPool.submit(new ForkJoinCalculate(1, 100));
		Long invoke = forkJoinPool.invoke(new ForkJoinCalculate(1, 100));
		Long aLong = submit.get();
		System.out.println(aLong);
		System.out.println(invoke);
	}
}
